#ifndef PAGETRACKER_H
#define PAGETRACKER_H

// Keeps the pages in a stl map, to make sure we don't have unnecessary duplications
#include <string>
#include <list>
using namespace std;

#include "page.h"

class Page;

class PageTracker
{
public:
	// constructor that accpts an intitial url and number of levels to mine
	PageTracker(string initialUrl, unsigned long long maxLevel);

	// creates page if the page does not exist, and returns a pointer to it
	void addPage(string url, unsigned long long level);

	// creates a long list of new pages to fetch from adding up all the urls
	//   from the pages in currentLevel_ - 1
	// after generating the list of urls to get, it creates pages from those
	//   urls, assigning currentLevel_ as the level 
	void scan();

	// outputs the graph in graphviz format to the screen (can be piped into a file)
	void outputToGrahpviz();

private:
	// where a single copy of each page is stored
	list<Page> allPages;

	// used to iterate through allPages
	list<Page>::iterator it;

	// how deep to mine (the initial url is considered to be level 1)
	unsigned long long maxLevel_;

	// the current level (changes with each new round of pages)
	unsigned long long currentLevel_;
};

#endif
